package com.yixun.qfbao.model.enums;

import org.apache.commons.lang.StringUtils;

/*
api接口枚举类
 */
public enum ApiActionEnum {

    BASE_TYPE(1000,"基础接口"),
    PREMISES_AYS(2000,"楼盘同步"),
    PREMISES_AYS_PUTAWAY(2001,"楼盘上架"),
    PREMISES_AYS_TAKEAWAY(2002,"楼盘下架"),
    PREMISE_SALE_BEFORE(2003,"待售"),
    PREMISES_SALE_ON(2004,"在售"),
    PREMISES_SALE_OFF(2005,"售罄"),
    PREMISES_DELETE(2006,"楼盘删除"),
    PREMISES_DYNAMIC(3001,"楼盘动态"),
    REPORT_ADD(4000,"报备同步"),
    REPORT_AUDIT(4001,"报备审核"),
    REPORT_AUDIT_YES(4002,"未到访"),
    REPORT_AUDIT_VISITED(4003,"未到访"),
    REPORT_AUDIT_NO(4004,"报备无效"),
    REPORT_AUDIT_PAYDEPOSIT(4005,"认筹"),
    REPORT_AUDIT_SUBSCRIBE(4006,"认购"),
    REPORT_AUDIT_SIGN(4007,"签约"),
    REPORT_DEAL_NO(4008,"交易失败"),
    REPORT_RESET(4009,"状态重置"),
    EXCHANGE_HOUSES(4010,"换房"),
    REPORT_REVISIT(4011,"复访"),
    FOLLOW_AYS(5000,"报备跟进"),
    EMPLOYEE_INFO(6000, "V10经纪人信息推送"),
    PREMISES_REPORT_MODEL(7000, "楼盘报备模板同步"),
    REPORT_M2(8000,"M2信息同步")
    ;

    private Integer no;
    private String  des;

    /**
     * 私有构造函数
     * @param no
     * @param des
     */
    ApiActionEnum(Integer no, String des) {
        this.no = no;
        this.des = des;
    }

    /**
     * @return Returns the no.
     */
    public Integer getNo() {
        return no;
    }

    /**
     * @return Returns the des.
     */
    public String getDes() {
        return des;
    }


    /**
     * 通过枚举<code>des</code>获得枚举
     *
     * @param des
     * @return
     */
    public static ApiActionEnum getByDescription(String des) {
        if(StringUtils.isBlank(des)){
            return null;
        }
        for (ApiActionEnum menum : values()) {
            if (menum.getDes().equals(des)) {
                return menum;
            }
        }
        return null;
    }
    public static ApiActionEnum getByNo(String no) {
        if(StringUtils.isBlank(no)){
            return null;
        }
        for (ApiActionEnum menum : values()) {
            if (menum.getNo().equals(no)) {
                return menum;
            }
        }
        return null;
    }

}
